class  clusters::sshdconfig inherits clusters {
   
   if $enable_allowgroups {
     sshd_config { 'AllowGroups':
       ensure => present,
       value  => $allowgroups,
       notify => Service['sshd'],
     }
     sshd_config { 'AllowUsers':
       ensure => 'absent',
       notify => Service['sshd'],
     }
   }
   elsif $enable_allowusers {
     sshd_config { 'AllowUsers':
       ensure => present,
       value  => $allowusers,
       notify => Service['sshd'],
     }
     sshd_config { 'AllowGroups':
       ensure => 'absent',
       notify => Service['sshd'],
     }
   }

   elsif $enable_sshmaxstartups {
     sshd_config { 'MaxStartups':
       ensure => present,
       value  => $sshmaxstartups,
       notify => Service['sshd'],
     }
   }


   else {
     sshd_config { 'AllowGroups':
       ensure => 'absent',
       notify => Service['sshd'],
     }
     sshd_config { 'AllowUsers':
       ensure => 'absent',
       notify => Service['sshd'],
     }
   }
   sshd_config { 'RSAAuthentication':
       ensure => absent,
   }
   sshd_config { 'PubkeyAuthentication':
       ensure => present,
       value  => yes,
       notify => Service['sshd'],
   }
   sshd_config { 'UsePrivilegeSeparation':
       ensure => present,
       value  => no,
       notify => Service['sshd'],
   }
   #sshd_config { 'GSSAPIAuthentication':
   #  ensure => present,
   #  value  => no,
   #  notify => Service['sshd'],
   #}

   if $login_node {
     sshd_config { 'PrintMotd':
         ensure => present,
         value  => yes,
         notify => Service['sshd'],
     }
     case $operatingsystemmajrelease {
       '5': {
          file { "/etc/ssh/ssh_host_key":
            mode       =>  '0600',
            owner      =>  'root',
            group      =>  'root',
            source     =>  "puppet:///modules/${module_name}/ssh5/ssh_host_key",
            notify => Service['sshd'],
          }
          file { "/etc/ssh/ssh_host_key.pub":
            mode       =>  '0644',
            owner      =>  'root',
            group      =>  'root',
            source     =>  "puppet:///modules/${module_name}/ssh5/ssh_host_key.pub",
            notify => Service['sshd'],
         }
         file { "/etc/ssh/ssh_host_dsa_key":
            mode       =>  '0600',
            owner      =>  'root',
            group      =>  'root',
            source     =>  "puppet:///modules/${module_name}/ssh5/ssh_host_dsa_key",
            notify => Service['sshd'],
          }
          file { "/etc/ssh/ssh_host_dsa_key.pub":
            mode       =>  '0644',
            owner      =>  'root',
            group      =>  'root',
            source     =>  "puppet:///modules/${module_name}/ssh5/ssh_host_dsa_key.pub",
            notify => Service['sshd'],
          }
          file { "/etc/ssh/ssh_host_rsa_key":
            mode       =>  '0600',
            owner      =>  'root',
            group      =>  'root',
            source     =>  "puppet:///modules/${module_name}/ssh5/ssh_host_rsa_key",
            notify => Service['sshd'],
          }
          file { "/etc/ssh/ssh_host_rsa_key.pub":
            mode       =>  '0644',
            owner      =>  'root',
            group      =>  'root',
            source     =>  "puppet:///modules/${module_name}/ssh5/ssh_host_rsa_key.pub",
            notify => Service['sshd'],
          }
       }
       '6','7': {
          file { "/etc/ssh/ssh_host_key":
            mode       =>  '0600',
            owner      =>  'root',
            group      =>  'root',
            source     =>  "puppet:///modules/${module_name}/ssh6/ssh_host_key",
            notify => Service['sshd'],
          }
          file { "/etc/ssh/ssh_host_key.pub":
            mode       =>  '0644',
            owner      =>  'root',
            group      =>  'root',
            source     =>  "puppet:///modules/${module_name}/ssh6/ssh_host_key.pub",
            notify => Service['sshd'],
         }
         file { "/etc/ssh/ssh_host_dsa_key":
            mode       =>  '0600',
            owner      =>  'root',
            group      =>  'root',
            source     =>  "puppet:///modules/${module_name}/ssh6/ssh_host_dsa_key",
            notify => Service['sshd'],
          }
          file { "/etc/ssh/ssh_host_dsa_key.pub":
            mode       =>  '0644',
            owner      =>  'root',
            group      =>  'root',
            source     =>  "puppet:///modules/${module_name}/ssh6/ssh_host_dsa_key.pub",
            notify => Service['sshd'],
          }
          file { "/etc/ssh/ssh_host_rsa_key":
            mode       =>  '0600',
            owner      =>  'root',
            group      =>  'root',
            source     =>  "puppet:///modules/${module_name}/ssh6/ssh_host_rsa_key",
            notify => Service['sshd'],
          }
          file { "/etc/ssh/ssh_host_rsa_key.pub":
            mode       =>  '0644',
            owner      =>  'root',
            group      =>  'root',
            source     =>  "puppet:///modules/${module_name}/ssh6/ssh_host_rsa_key.pub",
            notify => Service['sshd'],
          }
          file { "/etc/ssh/ssh_host_ecdsa_key":
            mode       =>  '0600',
            owner      =>  'root',
            group      =>  'root',
            source     =>  "puppet:///modules/${module_name}/ssh6/ssh_host_ecdsa_key",
            notify => Service['sshd'],
          }
          file { "/etc/ssh/ssh_host_ecdsa_key.pub":
            mode       =>  '0600',
            owner      =>  'root',
            group      =>  'root',
            source     =>  "puppet:///modules/${module_name}/ssh6/ssh_host_ecdsa_key.pub",
            notify => Service['sshd'],
          }
          file { "/etc/ssh/ssh_host_ed25519_key":
            mode       =>  '0600',
            owner      =>  'root',
            group      =>  'root',
            source     =>  "puppet:///modules/${module_name}/ssh6/ssh_host_ed25519_key",
            notify => Service['sshd'],
          }
          file { "/etc/ssh/ssh_host_ed25519_key.pub":
            mode       =>  '0600',
            owner      =>  'root',
            group      =>  'root',
            source     =>  "puppet:///modules/${module_name}/ssh6/ssh_host_ed25519_key.pub",
            notify => Service['sshd'],
          }
       } # 6,7
     }
   }
}
